This markdown will be utilized for data cleaning and diagnostic checks
In the cannon task, participants are instructed to place a shield at any point around a circle (Nassar et al., 2019). This shield covers only a portion of the 360-degree circle. The goal of the task is to infer where a cannonball might hit along the circle based on the information gathered from previous cannonball strikes and place the shield at those locations. Before each block of the task, the generative structure of the block is fully explained to the participants via written instructions and practice trials of the task. During the practice trials, participants can see where the cannon is aimed and use that information to place their shield. The cannon could theoretically hit anywhere within a 10-degree range from the center of the cannon’s muzzle. After this practice phase, participants complete the primary experiment where the cannon is removed and they must infer the cannon’s aim. The pattern of the cannon’s aim can either (1) change slightly within a specified range of the circle, with “oddball” cannonball shots striking about 14 percent of the time anywhere along the circle, or (2) remain stationary on most trials, and re-position to a random angle on approximately 14 percent of trials and remain stationary at this new angle. Participants receive explicit instructions regarding the nature of each of these blocks following the instructional phase, meaning they know whether the upcoming block will be from an oddball or change-point distribution. Participants complete 240 experimental trials in each condition, divided into 60-trial blocks, for a total of 480 trials. On each trial, participants adjust the position of their shield and lock in their decision. After their choice has been made, there is a 500ms delay before the location of the cannonball is revealed for 500ms. This provides an explicit representation of how far away the center of the shield fell from the cannonball’s strike, providing visual feedback about their PE from the cannonball’s actual location (Figure 2a, ii). After participants are shown how far off they were, the outcome of the task is revealed (Figure 2a, iii). After another brief delay (1000ms), the size of the participant’s shield is revealed alongside the cannonball, showing whether they successfully blocked the projectile. While the shield is always centered on the participant’s chosen location, it varies in size such that participants are never totally certain they will block the cannonball. Thus, minimizing the PE in the feedback phase is the optimal strategy for performing well in the task. At the end of a block, participants are provided feedback in terms of how many cannonballs they caught as a percentage of the total cannonballs.
This dataframe resulting from this cleaning is an example dataset. Because the cleaning code will be updated, the current cleaning code does not need to be reviewed unless you suspect anaomalies in the resulting dataframe. For any questions related to the definition of task variables, please refer to: https://docs.google.com/spreadsheets/d/1V2UD28C_zAfH90BnNO3si6c0-qDUDFbHoU44rfdEt4I/edit#gid=1309555968. Skip to heading Pilot Results for information on pilot data.
It should also be noted that data for this pilot came from two, slightly different versions of the ADLT. The first version failed to record trial latency. Thus, latencies were only examined for a subset of participants.
####Setup - Conditionals
plot_print <- "all" # could be "random"
It is important to get rid of excess trials and only retain information that will be important in analysis.
This chunk sets new variables and alters any old ones that need to be tidied. The variables created by the set_vars vector are:
predErr. Absolute prediction error (calculated using the discrep function): the PE from outcome to shield placement distMean. Prediction error from mean of distribution to shield placement. Calculated with discrep function. catch_miss. Codes values as factors “catch”, “miss”, “noresp”. Used for coding and mean comparison changepoint A column that reflects the trial number of changepoints. contains trial number when changepoint occurs and NA when no changepoint has occured.
Table 1. High-Level Task Performance. This check returns block-level info about subject’s performance. Participants are flagged if they did not respond to more than half of trials.
set_vars <- c("predErr", "distMean", "catch_miss", "changepoint", "perf", "total_trialnum" ) ##name variables needed for analysis, add as they become apparent
trim_cols <- TRUE
cannon_data <- create_vars(cannon_data, set_vars) ## Intialize rows to calculate
cannon_data <- cannon_data %>% ungroup() %>% group_by(subject) %>% mutate(cBal = ifelse(cond[1] == "CHANGEPOINT", 2, 1))
if (trim_cols == TRUE){
if (cannon_data$percentTrialsStay == .86){
drop <- c("percentTrialsStay","blockcode","trialcode",
"block.InstructionBlock.timestamp","trial.begin_block.timestamp",
"trial.mainloop.timestamp","trial.placeshield_mouse.timestamp","trial.showPE.timestamp"
,"trial.cannon_outcome.timestamp","picture.shield.currentitem")
}
drop <- c("blockcode","trialcode",
"block.InstructionBlock.timestamp","trial.begin_block.timestamp",
"trial.mainloop.timestamp","trial.placeshield_mouse.timestamp"
, "trial.showPE.timestamp"
,"trial.cannon_outcome.timestamp","picture.shield.currentitem")
cannon_data <- cannon_data[,!(names(cannon_data) %in% drop)]
}
cleaned_names <- colnames(cannon_data)
save(model_names, iq_names, cleaned_names, file = "cannon_processing.Rdata")
It’s probably worth writing this into a function as well. I should probably do this before I implement high-level checks. Ideas for things I might need to check are: Miscodes. Misses that are actually hits, Hits that are actually misses, etc. Odd numbers of trials Participants bailing early on the task, getting stuck somewhere, etc.
In this pilot data, we are still getting occasional hits and misses that don’t make sense. I think this is due to
cannon_data <- check_irreg(cannon_data) #check for any mistaken hits
irreg_plot_hit <- cannon_data %>% filter(grepl("CHECK_HIT", Irreg)) %>% select(subject, cond, blocknum, trialnum, catch_miss, angmu, placementAngle, outcome, predErr, angleup, angledown, shield_size)
irreg_plot_miss <- cannon_data %>% filter(grepl("CHECK_MISS", Irreg)) %>% select(subject, cond, blocknum, trialnum, catch_miss, angmu, placementAngle, outcome, predErr, angleup, angledown, shield_size)
irreg_plot_NA <- cannon_data %>% filter(grepl("CHECK_NA", Irreg)) %>% select(subject, cond, blocknum, trialnum, catch_miss, angmu, placementAngle, outcome, predErr, angleup, angledown, shield_size)
range <- cannon_data %>%
group_by(subject, time) %>% summarise(placement_angle_min = min(cannon_data$placementAngle %>% na.omit),
placement_angle_max = max(cannon_data$placementAngle %>% na.omit),
outcome_min = min(cannon_data$outcome %>% na.omit),
outcome_max = max(cannon_data$outcome %>% na.omit),
angleup_min = min(cannon_data$angleup %>% na.omit),
angleup_max = max(cannon_data$angleup %>% na.omit),
angledown_min = min(cannon_data$angledown %>% na.omit),
angledown_max = max(cannon_data$angledown %>% na.omit))
if(nrow(irreg_plot_hit) > 0){
irreg_plot_hit
}
if(nrow(irreg_plot_miss) > 0){
irreg_plot_miss
}
if(nrow(irreg_plot_NA) > 0){
irreg_plot_NA
}
obj <- cannon_data %>% group_by(subject, cond, blocknum, totalearnings) %>%
summarise(obscount = n(), avg_PE = mean(predErr, na.rm = TRUE),
dist_mean = mean(distMean,na.rm = TRUE),
percent_caught = max(cannonballs_caught/max(trialnum)),
percent_noresp = (sum(outcomeindex == 1)/max(trialnum)),
num_changepoints = sum(!is.na(changepoint))) %>%
arrange(subject,totalearnings) %>% group_by(subject) %>% mutate(taskearnings = max(totalearnings)) %>% mutate(Avg_overall_PE = mean(avg_PE, na.rm = TRUE)) %>% ungroup()
#save(obj, cannon_data, file = "Cannonball_Pilot_Example_Perfect_Data.Rdata")
colormatrix <- ifelse(obj$percent_noresp >= .2 || obj$obscount != 60, wes_palette("Cavalcanti1")[c(1)], "white") ##potentially save these as bad_blocks vector
bad_blocks <- obj %>% dplyr::filter( percent_noresp >= .2)
tab <- obj %>% flextable() %>% flextable::bg(j = 1:ncol(obj), bg=colormatrix)
cannon_earnings <- cannon_data %>% group_by(subject) %>% summarize(cents_earned = max(totalearnings)) %>% dplyr::rename(centsearned_c = cents_earned)
save(cannon_earnings, file = "~/github_repos/PUBS_Data_Verification/Payment/Cannon.Rdata")
tab
subject | cond | blocknum | totalearnings | obscount | avg_PE | dist_mean | percent_caught | percent_noresp | num_changepoints | taskearnings | Avg_overall_PE |
1 | CHANGEPOINT | 1 | 5.5 | 61 | 28.57241 | 25.43876 | 0.45000000 | 0.03333333 | 8 | 77.0 | 37.30636 |
1 | CHANGEPOINT | 2 | 19.0 | 60 | 38.05989 | 32.73208 | 0.36666667 | 0.00000000 | 12 | 77.0 | 37.30636 |
1 | CHANGEPOINT | 3 | 30.0 | 60 | 37.26992 | 32.46648 | 0.33333333 | 0.00000000 | 8 | 77.0 | 37.30636 |
1 | CHANGEPOINT | 4 | 40.0 | 60 | 35.36616 | 31.68708 | 0.33333333 | 0.00000000 | 9 | 77.0 | 37.30636 |
1 | ODDBALL | 1 | 50.0 | 60 | 43.61514 | 28.85173 | 0.26666667 | 0.00000000 | 5 | 77.0 | 37.30636 |
1 | ODDBALL | 2 | 58.0 | 60 | 46.13887 | 30.15980 | 0.26666667 | 0.00000000 | 11 | 77.0 | 37.30636 |
1 | ODDBALL | 3 | 66.0 | 60 | 36.94918 | 22.66622 | 0.36666667 | 0.00000000 | 6 | 77.0 | 37.30636 |
1 | ODDBALL | 4 | 77.0 | 60 | 32.47935 | 21.40885 | 0.46666667 | 0.00000000 | 7 | 77.0 | 37.30636 |
2 | CHANGEPOINT | 1 | 7.0 | 60 | 29.25884 | 19.61928 | 0.38333333 | 0.00000000 | 4 | 88.0 | 33.63463 |
2 | CHANGEPOINT | 2 | 18.5 | 60 | 42.18353 | 38.46954 | 0.45000000 | 0.00000000 | 13 | 88.0 | 33.63463 |
2 | CHANGEPOINT | 3 | 32.0 | 60 | 34.67389 | 27.08286 | 0.30000000 | 0.00000000 | 7 | 88.0 | 33.63463 |
2 | CHANGEPOINT | 4 | 41.0 | 61 | 43.84397 | 41.21644 | 0.28333333 | 0.01666667 | 12 | 88.0 | 33.63463 |
2 | ODDBALL | 1 | 53.0 | 60 | 35.55227 | 15.69472 | 0.36666667 | 0.00000000 | 8 | 88.0 | 33.63463 |
2 | ODDBALL | 2 | 64.0 | 60 | 30.37823 | 13.40500 | 0.38333333 | 0.00000000 | 8 | 88.0 | 33.63463 |
2 | ODDBALL | 3 | 75.5 | 60 | 28.00765 | 14.21174 | 0.41666667 | 0.00000000 | 10 | 88.0 | 33.63463 |
2 | ODDBALL | 4 | 88.0 | 60 | 25.17868 | 15.76184 | 0.46666667 | 0.00000000 | 8 | 88.0 | 33.63463 |
3 | CHANGEPOINT | 1 | 4.5 | 60 | 37.56316 | 35.19248 | 0.31666667 | 0.00000000 | 8 | 78.5 | 39.62752 |
3 | CHANGEPOINT | 2 | 14.0 | 60 | 39.44665 | 32.03193 | 0.30000000 | 0.00000000 | 11 | 78.5 | 39.62752 |
3 | CHANGEPOINT | 3 | 23.0 | 60 | 30.04862 | 26.33717 | 0.46666667 | 0.00000000 | 6 | 78.5 | 39.62752 |
3 | CHANGEPOINT | 4 | 37.0 | 60 | 42.13802 | 40.73848 | 0.30000000 | 0.00000000 | 11 | 78.5 | 39.62752 |
3 | ODDBALL | 1 | 46.5 | 60 | 37.93130 | 24.53172 | 0.40000000 | 0.00000000 | 8 | 78.5 | 39.62752 |
3 | ODDBALL | 2 | 58.5 | 62 | 30.12490 | 20.58841 | 0.40000000 | 0.03333333 | 4 | 78.5 | 39.62752 |
3 | ODDBALL | 3 | 70.5 | 61 | 51.57339 | 31.32131 | 0.26666667 | 0.03333333 | 13 | 78.5 | 39.62752 |
3 | ODDBALL | 4 | 78.5 | 64 | 48.19414 | 34.59539 | 0.20000000 | 0.06666667 | 9 | 78.5 | 39.62752 |
4 | CHANGEPOINT | 1 | 2.0 | 63 | 61.32413 | 56.89049 | 0.21666667 | 0.05000000 | 11 | 49.5 | 69.88420 |
4 | CHANGEPOINT | 2 | 8.5 | 60 | 48.36553 | 44.13776 | 0.26666667 | 0.00000000 | 6 | 49.5 | 69.88420 |
4 | CHANGEPOINT | 3 | 16.5 | 60 | 59.55872 | 55.39387 | 0.21666667 | 0.00000000 | 9 | 49.5 | 69.88420 |
4 | CHANGEPOINT | 4 | 23.0 | 60 | 42.96416 | 41.50614 | 0.21666667 | 0.00000000 | 6 | 49.5 | 69.88420 |
4 | ODDBALL | 1 | 31.5 | 62 | 65.84048 | 53.63329 | 0.16666667 | 0.05000000 | 11 | 49.5 | 69.88420 |
4 | ODDBALL | 2 | 36.5 | 60 | 60.24451 | 48.93795 | 0.28333333 | 0.00000000 | 11 | 49.5 | 69.88420 |
4 | ODDBALL | 3 | 45.0 | 60 | 80.97628 | 76.76220 | 0.15000000 | 0.00000000 | 9 | 49.5 | 69.88420 |
4 | ODDBALL | 4 | 49.5 | 60 | 139.79981 | 148.19994 | 0.03333333 | 0.00000000 | 6 | 49.5 | 69.88420 |
5 | CHANGEPOINT | 1 | 5.5 | 60 | 43.48542 | 40.99574 | 0.28333333 | 0.00000000 | 10 | 29.0 | 75.31406 |
5 | CHANGEPOINT | 2 | 14.0 | 62 | 100.55735 | 100.48869 | 0.08333333 | 0.03333333 | 6 | 29.0 | 75.31406 |
5 | CHANGEPOINT | 3 | 16.5 | 60 | 97.62568 | 101.84511 | 0.01666667 | 0.00000000 | 8 | 29.0 | 75.31406 |
5 | CHANGEPOINT | 4 | 17.0 | 60 | 81.51047 | 85.08322 | 0.03333333 | 0.00000000 | 11 | 29.0 | 75.31406 |
5 | ODDBALL | 1 | 19.0 | 60 | 38.70148 | 31.58045 | 0.28333333 | 0.00000000 | 6 | 29.0 | 75.31406 |
5 | ODDBALL | 2 | 27.5 | 62 | 102.65315 | 107.66368 | 0.01666667 | 0.05000000 | 12 | 29.0 | 75.31406 |
5 | ODDBALL | 3 | 28.0 | 61 | 88.69238 | 91.93248 | 0.03333333 | 0.01666667 | 6 | 29.0 | 75.31406 |
5 | ODDBALL | 4 | 29.0 | 60 | 49.28656 | 41.94001 | 0.05000000 | 0.00000000 | 9 | 29.0 | 75.31406 |
6 | ODDBALL | 1 | 3.5 | 61 | 37.98227 | 25.23127 | 0.31666667 | 0.01666667 | 5 | 73.5 | 38.92062 |
6 | ODDBALL | 2 | 13.0 | 61 | 40.33414 | 23.28162 | 0.33333333 | 0.01666667 | 9 | 73.5 | 38.92062 |
6 | ODDBALL | 3 | 23.0 | 60 | 36.23341 | 27.00956 | 0.38333333 | 0.00000000 | 11 | 73.5 | 38.92062 |
6 | ODDBALL | 4 | 34.5 | 60 | 30.56471 | 19.30098 | 0.26666667 | 0.00000000 | 7 | 73.5 | 38.92062 |
6 | CHANGEPOINT | 1 | 44.5 | 61 | 43.17348 | 36.01053 | 0.26666667 | 0.03333333 | 9 | 73.5 | 38.92062 |
6 | CHANGEPOINT | 2 | 52.5 | 64 | 53.00513 | 47.53803 | 0.30000000 | 0.06666667 | 8 | 73.5 | 38.92062 |
6 | CHANGEPOINT | 3 | 61.5 | 60 | 34.69699 | 31.78746 | 0.40000000 | 0.00000000 | 6 | 73.5 | 38.92062 |
6 | CHANGEPOINT | 4 | 73.5 | 60 | 35.37480 | 30.33639 | 0.33333333 | 0.00000000 | 12 | 73.5 | 38.92062 |
7 | CHANGEPOINT | 1 | 0.0 | 60 | 40.66349 | 35.60201 | 0.31666667 | 0.00000000 | 9 | 74.5 | 37.29892 |
7 | CHANGEPOINT | 2 | 9.5 | 60 | 27.04687 | 23.35355 | 0.36666667 | 0.00000000 | 3 | 74.5 | 37.29892 |
7 | CHANGEPOINT | 3 | 20.5 | 61 | 30.04224 | 25.83408 | 0.46666667 | 0.01666667 | 12 | 74.5 | 37.29892 |
7 | CHANGEPOINT | 4 | 34.5 | 61 | 37.47490 | 30.40378 | 0.26666667 | 0.01666667 | 9 | 74.5 | 37.29892 |
7 | ODDBALL | 1 | 46.5 | 60 | 45.16682 | 32.25146 | 0.31666667 | 0.01666667 | 8 | 74.5 | 37.29892 |
7 | ODDBALL | 2 | 56.0 | 60 | 35.17018 | 24.62808 | 0.28333333 | 0.00000000 | 10 | 74.5 | 37.29892 |
7 | ODDBALL | 3 | 64.5 | 60 | 35.92872 | 27.67704 | 0.33333333 | 0.00000000 | 7 | 74.5 | 37.29892 |
7 | ODDBALL | 4 | 74.5 | 60 | 46.89815 | 33.29305 | 0.33333333 | 0.00000000 | 9 | 74.5 | 37.29892 |
8 | CHANGEPOINT | 1 | 6.5 | 60 | 35.30693 | 30.17154 | 0.31666667 | 0.00000000 | 11 | 90.0 | 35.16747 |
8 | CHANGEPOINT | 2 | 16.0 | 60 | 28.51948 | 23.11586 | 0.43333333 | 0.00000000 | 6 | 90.0 | 35.16747 |
8 | CHANGEPOINT | 3 | 29.0 | 61 | 32.26233 | 28.39336 | 0.50000000 | 0.01666667 | 10 | 90.0 | 35.16747 |
8 | CHANGEPOINT | 4 | 44.0 | 60 | 28.79312 | 24.19570 | 0.38333333 | 0.00000000 | 8 | 90.0 | 35.16747 |
8 | ODDBALL | 1 | 58.0 | 62 | 33.76679 | 24.90069 | 0.35000000 | 0.03333333 | 7 | 90.0 | 35.16747 |
8 | ODDBALL | 2 | 68.5 | 60 | 45.50053 | 31.28700 | 0.36666667 | 0.01666667 | 11 | 90.0 | 35.16747 |
8 | ODDBALL | 3 | 79.5 | 61 | 36.77021 | 26.72365 | 0.35000000 | 0.01666667 | 8 | 90.0 | 35.16747 |
8 | ODDBALL | 4 | 90.0 | 61 | 40.42039 | 24.19237 | 0.21666667 | 0.01666667 | 6 | 90.0 | 35.16747 |
Figure 1. Below is a histogram of all reaction time data.This is beautiful!Tried both with and without subject 456, who seems a little problematic based on the summary statistics. Overall, happy with this!
Hist_outliers <- ggplot(cannon_data %>% filter(!subject == 456), aes(x=trial.placeshield_mouse.latency)) + geom_histogram()
Mean_cleaned <- cannon_data %>% filter(!subject == 456) %>% ungroup () %>% filter(!trial.placeshield_mouse.latency == 2500) %>% summarise(mean = mean(trial.placeshield_mouse.latency))
Hist_outliers; Mean_cleaned
## # A tibble: 1 x 1
## mean
## <dbl>
## 1 488.
I’m having some trouble with graphing this. For whatever reason, the oddball graphs are not happy with the tabset format. Everything else seems to be playing nicely, and it seems as though participants are learning across the task.
cowplotcp <- list();cowplotodd <- list()
subjects <- sort(unique(cannon_data$subject))
subjects <- as.character(subjects)
subjects_list <- list(as.character(unique(cannon_data$subject)))
for (i in subjects) {
o <- cannon_data %>% dplyr::filter(subject == i & cond == "ODDBALL") %>% filter(!is.na(predErr))
cowplotodd[[i]] <- local({
i <- i
oddballPE <- ggplot(o, aes(x=trialnum, y=predErr, color = catch_miss)) + geom_point() +
geom_vline(aes(xintercept = changepoint, color = "Oddball")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,5,2)])) + xlab("Trial Number") + ylab("Response Type") + ggtitle("Raw Prediction Error") + ylab("Size Of Prediction Error") + theme(legend.position = "none") + facet_wrap(~blocknum, ncol = 1)
#oddball_PE[[i]] <- oddballPE
get_legendo <- ggplot(o, aes(x=trialnum, y=distMean, color = catch_miss)) + geom_point() +
geom_vline(aes(xintercept = changepoint, color = "Oddball")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,5,2)]))
legendo <- get_legend(get_legendo)
oddballDM <- ggplot(o, aes(x=trialnum, y=distMean, color = catch_miss)) + geom_point() +
geom_vline(aes(xintercept = changepoint, color = "Oddball")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,5,2)])) + ggtitle ("Distance from Mean") + xlab("Trial Number") + ylab("Size Of Prediction Error") + theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) + theme(legend.position = "none") + facet_wrap(~blocknum, ncol = 1)
#changepoint_DM[[i]] <- changepointDM
#oddball_DM[[i]] <- oddballDM
i <- cowplot::plot_grid(oddballPE, oddballDM, legendo, ncol = 3, rel_widths = c(2.5,2.1,1))})
}
for (i in subjects){
c <- cannon_data %>% dplyr::filter(subject == i & cond == "CHANGEPOINT") %>% filter(!is.na(predErr))
cowplotcp[[i]] <- local({
i <- i
changepointPE <- ggplot(c,aes(x=trialnum, y=predErr, color = catch_miss)) + geom_point() + geom_vline(aes(xintercept = changepoint, color = "Changepoint")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,2,5,1)])) +
xlab("Trial Number") + ylab("Response Type") + ggtitle("Raw Prediction Error") + ylab("Size Of Prediction Error") +
theme(legend.position = "none") + facet_wrap(~blocknum, ncol = 1)
#changepoint_PE[[i]] <- changepointPE
changepointDM <- ggplot(c, aes(x=trialnum, y=distMean, color = catch_miss)) + geom_point() + geom_vline(aes(xintercept = changepoint, color = "Changepoint")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,2,5,1)])) + ggtitle ("Distance from Mean") + xlab("Trial Number") + ylab("Size Of Prediction Error") +
theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) +
theme(legend.position = "none") + facet_wrap(~blocknum, ncol = 1)
get_legendc <- ggplot(c, aes(x=trialnum, y=distMean, color = catch_miss)) + geom_point() + geom_vline(aes(xintercept = changepoint, color = "Changepoint")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,2,5,1)]))
#changepoint_DM[[i]] <- changepointDM
legendc <- get_legend(get_legendc)
i <- cowplot::plot_grid(changepointPE, changepointDM, legendc, ncol = 3, rel_widths = c(2.5,2.1,1))
})
}
temp_cp <- c(
"### Subject {{nm}}\n",
"```{r, echo = FALSE}\n",
"cowplotcp[[{{nm}}]] \n",
"```\n",
"\n"
)
plots <- lapply(1:length(cowplotcp), function(nm) {knitr::knit_expand(text = temp_cp)})
template <- c(
"### Subject {{w}}\n",
"```{r, echo = FALSE}\n",
"cowplotodd[[{{w}}]] \n",
"```\n",
"\n"
)
plots <- lapply(1:length(cowplotodd), function(w) {knitr::knit_expand(text = template)})
a_1 <- aov(trial.placeshield_mouse.latency ~ cond, data = cannon_data)
summary(a_1)
## Df Sum Sq Mean Sq F value Pr(>F)
## cond 1 1072643 1072643 6.893 0.00869 **
## Residuals 3831 596132377 155608
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 40 observations deleted due to missingness
rt_trialnum <- lm(trial.placeshield_mouse.latency ~ trialnum + cond + blocknum + cBal, data = cannon_data)
summary(rt_trialnum)
##
## Call:
## lm(formula = trial.placeshield_mouse.latency ~ trialnum + cond +
## blocknum + cBal, data = cannon_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -561.5 -262.4 -111.3 140.9 2039.6
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 426.3145 40.8519 10.436 < 2e-16 ***
## trialnum -0.9644 0.3629 -2.658 0.0079 **
## condODDBALL -33.3390 12.5639 -2.654 0.0080 **
## blocknum -46.0004 5.6193 -8.186 3.64e-16 ***
## cBal 118.5772 18.9970 6.242 4.79e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 388.9 on 3828 degrees of freedom
## (40 observations deleted due to missingness)
## Multiple R-squared: 0.03044, Adjusted R-squared: 0.02943
## F-statistic: 30.04 on 4 and 3828 DF, p-value: < 2.2e-16
emmeans(rt_trialnum, "cond")
## cond emmean SE df lower.CL upper.CL
## CHANGEPOINT 460 11.4 3828 437 482
## ODDBALL 426 11.4 3828 404 449
##
## Results are averaged over the levels of: cBal
## Confidence level used: 0.95
#emmeans(rt_trialnum, as.character("blocknum"))
#maybe give this an option?
save(cannon_data, file = "~/github_repos/Cannon_Task_Inquisit/Data/cannon_proc.RData")
# if (modeling_ext == TRUE){
# tidy_for_model(cannon_data)
# }